package mm.util;

import junit.framework.TestCase;

public class StringUtilsTest extends TestCase {

	protected void setUp() throws Exception {
		super.setUp();
	}

	protected void tearDown() throws Exception {
		super.tearDown();
	}

	public void testDescribe() {
		fail("Not yet implemented");
	}

	public void testBuild() {
		fail("Not yet implemented");
	}

	public void testMatchWildcard() {
		String in="abcdef";
		assertTrue(StringUtils.matchWildcard(in, "abcdef"));
		assertTrue(StringUtils.matchWildcard(in, "abc*"));
		assertTrue(StringUtils.matchWildcard(in, "*def"));
		assertTrue(StringUtils.matchWildcard(in, "ab*ef"));
		assertTrue(StringUtils.matchWildcard(in, "a*d*f"));
		assertTrue(StringUtils.matchWildcard(in, "a*c*e*"));
		assertTrue(StringUtils.matchWildcard(in, "*bcd*"));
		assertTrue(StringUtils.matchWildcard(in, "a*e*"));
		assertTrue(StringUtils.matchWildcard(in, "*"));
		assertTrue(StringUtils.matchWildcard(in, "**"));
		assertTrue(StringUtils.matchWildcard(in, "ab**ef"));
		assertFalse(StringUtils.matchWildcard(in, "c*f"));
		assertFalse(StringUtils.matchWildcard(in, "a*g"));
		assertFalse(StringUtils.matchWildcard(in, "a*z*f"));
		assertFalse(StringUtils.matchWildcard(in, "a*e"));
	}

	public void testX() {
		String in="012789abcxyzABCXYZ";
		for(int i=0; i<in.length(); i++){
			char c=in.charAt(i);
			System.out.println((int)c);
		}
		System.out.println(StringUtils.lowerCase(in));
	}

	public void testEscapeJavascriptString() {
		String s=ActionHelper.readPageContent("/wiki/add.html");
		System.out.println(StringUtils.escapeJavascriptString(s));
	}

}
